//
//  CustomView.m
//  srcollView_demo
//
//  Created by SunChao on 17/8/25.
//  Copyright © 2017年 SunChao. All rights reserved.
//
#define RGBColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1]
#define topSpacing 16
#define leftSpacing 20
#define BottomEdge 30
#define Spacing 10
#import "CustomView.h"

@implementation CustomView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {

        _cImgView = [[UIImageView alloc] initWithFrame:CGRectMake(leftSpacing, topSpacing, CGRectGetWidth(frame)-2*leftSpacing, CGRectGetWidth(frame)-2*leftSpacing)];
        
        [self addSubview:_cImgView];
        
        _cButton = [[UIButton alloc] initWithFrame:CGRectMake(Spacing, Spacing, CGRectGetWidth(frame)-2*Spacing, CGRectGetHeight(frame)-Spacing-BottomEdge)];
        _cButton.backgroundColor = [UIColor clearColor];
        [self addSubview:_cButton];
        
        _cLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, CGRectGetHeight(frame)-BottomEdge-10, CGRectGetWidth(frame), BottomEdge)];
        _cLabel.textAlignment = NSTextAlignmentCenter;
        _cLabel.font = [UIFont systemFontOfSize:13];
        [self addSubview:_cLabel];
        
        
    }
    return self;
}

@end
